﻿using CPPEI.Coolzon.Common;
using CPPEI.Coolzon.Service.Contract;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CPPEI.Coolzon.UI.Views.EventProxies
{
    public class RespSetPropertyXmlStringEventHandler : BaseResponseHandler<RespSetPropertyXmlStringData>
    {
        protected override void OnHandle(RemoteEventProxy remoteEventProxy, ServiceProxy.MainServiceRef.Response response,
            RespSetPropertyXmlStringData responseData)
        {
            remoteEventProxy.RenderView.Dispatcher.Invoke(() =>
            {
                (remoteEventProxy.RenderView.GetCurrentPart() as ScenePart)
                    .GetChildPart(responseData.PartName, true)
                    .SetPropertyXmlString(responseData.PropertyName, responseData.XmlString);
            });
        }
    }
}
